#include "HardwareProfile.h"
unsigned char OneWire_GetIn(void)
{
	unsigned char r;
	switch(ChannelIndex)
	{
	case 0:
		Channel1_IO=1;
		ONEWIRE_DIR1_W=HC254_R;
		ONEWIRE_OE1_W=0;
		r=Channel1_R;
		ONEWIRE_OE1_W=1;
		break;
	case 1:
		Channel2_IO=1;
		ONEWIRE_DIR1_W=HC254_R;
		ONEWIRE_OE1_W=0;
		r=Channel2_R;
		ONEWIRE_OE1_W=1;
		break;
	case 2:
		Channel3_IO=1;
		ONEWIRE_DIR1_W=HC254_R;
		ONEWIRE_OE1_W=0;
		r=Channel3_R;
		ONEWIRE_OE1_W=1;
		break;
	case 3:
		Channel4_IO=1;
		ONEWIRE_DIR1_W=HC254_R;
		ONEWIRE_OE1_W=0;
		r=Channel4_R;
		ONEWIRE_OE1_W=1;
		break;
	case 4:
		Channel5_IO=1;
		ONEWIRE_DIR1_W=HC254_R;
		ONEWIRE_OE1_W=0;
		r=Channel5_R;
		ONEWIRE_OE1_W=1;
		break;
	case 5:
		Channel6_IO=1;
		ONEWIRE_DIR1_W=HC254_R;
		ONEWIRE_OE1_W=0;
		r=Channel6_R;
		ONEWIRE_OE1_W=1;
		break;
	case 6:
		Channel7_IO=1;
		ONEWIRE_DIR2_W=HC254_R;
		ONEWIRE_OE2_W=0;
		r=Channel7_R;
		ONEWIRE_OE2_W=1;
		break;	
	case 7:
		Channel8_IO=1;
		ONEWIRE_DIR2_W=HC254_R;
		ONEWIRE_OE2_W=0;
		r=Channel8_R;
		ONEWIRE_OE2_W=1;
		break;	
	case 8:
		Channel9_IO=1;
		ONEWIRE_DIR2_W=HC254_R;
		ONEWIRE_OE2_W=0;
		r=Channel9_R;
		ONEWIRE_OE2_W=1;
		break;	
	case 9:
		Channel10_IO=1;
		ONEWIRE_DIR2_W=HC254_R;
		ONEWIRE_OE2_W=0;
		r=Channel10_R;
		ONEWIRE_OE2_W=1;
		break;	
	case 10:
		Channel11_IO=1;
		ONEWIRE_DIR2_W=HC254_R;
		ONEWIRE_OE2_W=0;
		r=Channel11_R;
		ONEWIRE_OE2_W=1;
		break;	
	}
	return r;
}

void OneWire_SetLow(void)	
{
	switch(ChannelIndex)
	{
	case 0:
		Channel1_W=0;
		Channel1_IO=0;
		ONEWIRE_DIR1_W=HC254_W;
		ONEWIRE_OE1_W=0;
		break;
	case 1:
		Channel2_W=0;
		Channel2_IO=0;
		ONEWIRE_DIR1_W=HC254_W;
		ONEWIRE_OE1_W=0;
		break;
	case 2:
		Channel3_W=0;
		Channel3_IO=0;
		ONEWIRE_DIR1_W=HC254_W;
		ONEWIRE_OE1_W=0;
		break;
	case 3:
		Channel4_W=0;
		Channel4_IO=0;
		ONEWIRE_DIR1_W=HC254_W;
		ONEWIRE_OE1_W=0;
		break;
	case 4:
		Channel5_W=0;
		Channel5_IO=0;
		ONEWIRE_DIR1_W=HC254_W;
		ONEWIRE_OE1_W=0;
		break;
	case 5:
		Channel6_W=0;
		Channel6_IO=0;
		ONEWIRE_DIR1_W=HC254_W;
		ONEWIRE_OE1_W=0;
		break;
	case 6:
		Channel7_W=0;
		Channel7_IO=0;
		ONEWIRE_DIR2_W=HC254_W;
		ONEWIRE_OE2_W=0;
		break;	
	case 7:
		Channel8_W=0;
		Channel8_IO=0;
		ONEWIRE_DIR2_W=HC254_W;
		ONEWIRE_OE2_W=0;
		break;	
	case 8:
		Channel9_W=0;
		Channel9_IO=0;
		ONEWIRE_DIR2_W=HC254_W;
		ONEWIRE_OE2_W=0;
		break;	
	case 9:
		Channel10_W=0;
		Channel10_IO=0;
		ONEWIRE_DIR2_W=HC254_W;
		ONEWIRE_OE2_W=0;
		break;	
	case 10:
		Channel11_W=0;
		Channel11_IO=0;
		ONEWIRE_DIR2_W=HC254_W;
		ONEWIRE_OE2_W=0;
		break;	
	}
}

